keyboard ={
    x = 0,
    y = 0,
    timeout = 150,
    isDisable = false,
    getWidth = function ()
        return 225
    end,
    getHeight = function ()
        return 300
    end,
    update = function (dt)
        if gesture.isTouching() then
            local mouseX, mouseY = gesture.getOrigin()
            
            if keyboard.isInside(mouseX, mouseY) then
                xPress = mouseX - keyboard.x
                yPress = mouseY - keyboard.y
                for i=0, 11 do
                    if 
                        xPress >= 0+keyboard.getWidth()/3*(i-3*math.floor(i/3)) and 
                        xPress <= keyboard.getWidth()/3+keyboard.getWidth()/3*(i-3*math.floor(i/3))  and
                        yPress >= 0+keyboard.getWidth()/3*math.floor(i/3) and 
                        yPress <= keyboard.getWidth()/3+keyboard.getWidth()/3*math.floor(i/3) 
                    then
                        if i < 9 then
                            keyboard.onPress(i+1)
                        elseif i == 10 then
                            keyboard.onPress(0)
                        elseif i == 11 then
                            keyboard.onPress(false)
                        end
                        break
                    end
                end
            end
        end
    end,
    draw = function ()
        love.graphics.rectangle('line', keyboard.x, keyboard.y, keyboard.getWidth(), keyboard.getHeight())
        for i=1, 3 do
            love.graphics.line(
                keyboard.x,
                keyboard.y+keyboard.getWidth()/3*i,
                keyboard.x+keyboard.getWidth(), 
                keyboard.y+keyboard.getWidth()/3*i
            )
        end
        for i=1, 2 do
            love.graphics.line(
                keyboard.x+keyboard.getWidth()/3*i,
                keyboard.y,
                keyboard.x+keyboard.getWidth()/3*i,
                keyboard.y+keyboard.getHeight()
            )
        end
        for i=0, 8 do
            love.graphics.print(
                tostring(i+1),
                novaFont,
                (keyboard.x+keyboard.getWidth()/3/2)+keyboard.getWidth()/3*(i-3*math.floor(i/3)) ,
                keyboard.y + keyboard.getWidth()/3*math.floor(i/3)
            )
        end
        love.graphics.print(
            '0', 
            novaFont, 
            (keyboard.x+keyboard.getWidth()/3/2)+keyboard.getWidth()/3,
            keyboard.y+keyboard.getWidth()/3*3
        )
        love.graphics.print(
            '<', 
            novaFont, 
            (keyboard.x+keyboard.getWidth()/3/2)+keyboard.getWidth()/3*2,
            keyboard.y+keyboard.getWidth()/3*3
        )
        
    end,
    setPosition = function (x, y)
        keyboard.x = x or keyboard.x
        keyboard.y = y or keyboard.y
    end,
    isInside = function (x, y)
        return 
            x >= keyboard.x and x <= keyboard.x + keyboard.getWidth() and
            y >= keyboard.y and y <= keyboard.y + keyboard.getHeight()
    end,
}
